package com.enumdemo.multi_channel_distribution.demo2;

import java.util.EnumMap;
import java.util.Map;
import static com.enumdemo.multi_channel_distribution.demo1.Outcome.*;
import com.enumdemo.multi_channel_distribution.demo1.Outcome;
import com.enumdemo.multi_channel_distribution.demo5.RoShamBo;
import com.enumdemo.multi_channel_distribution.demo5.face.Competitor;

/**
 * 通过Enum实现多路分发
 * 
 * @author Administrator
 *
 */
public enum RoShamBo2 implements Competitor<RoShamBo2> {

	PAPER(DRAW, LOSE, WIN), SCISSORS(WIN, DRAW, LOSE), ROCK(LOSE, WIN, DRAW);

	private Outcome vPAPER, vSCISSORS, vROCK;

	RoShamBo2(Outcome paper, Outcome scissors, Outcome rock) {
		System.out.println("初始化");
		this.vPAPER = paper;
		this.vSCISSORS = scissors;
		this.vROCK = rock;
	}

	@Override
	public Outcome compete(RoShamBo2 competitor) {
		switch (competitor) {
		case PAPER:
			return vPAPER;
		case SCISSORS:
			return vSCISSORS;
		case ROCK:
			return vROCK;
		default:
			break;
		}
		return null;
	}

	public static void main(String[] args) {
		System.out.println("开始");
		RoShamBo.play(RoShamBo2.class, 20);
	}

}
